import { createStore } from 'vuex';

// 自动获取modules文件夹下的js文件，动态获取vue仓库配置
const modulesFiles = import.meta.globEager('./modules/*');
const keys = Object.keys(modulesFiles);
const modules = {};
keys.forEach((item) => {
  const key = item.replace(/(\.\/modules\/|\.js)/g, '');
  modules[key] = modulesFiles[item].default;
});

export default createStore({
  modules
});
